#################################################################
# This docker image build file creates an image that contains
# usc project.
#
#                    ##        .
#              ## ## ##       ==
#           ## ## ## ##      ===
#       /""""""""""""""""\___/ ===
#  ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
#       \______ o          __/
#         \    \        __/
#          \____\______/
#
# Component:    RNTD
# Author:       Dou Chunrong <douchunrong@gmail.com>
# Copyright:    (c) 2015-2016 RNTD Ltd. All rights reserved.
#################################################################
#version 0.0.1

FROM humbleadmin/docker_ror_nginx
MAINTAINER Dou Chunrong <douchunrong@gmail.com>

#设置环境变量
ENV NGINX_PATH /opt/nginx
ENV NGINX_CONF_PATH ${NGINX_PATH}/conf
ENV SERVER_NAME docker-h5-time
ENV SERVER_PATH /var/www/${SERVER_NAME}/

#设置 Mysql 参数
ENV USC_DB_NAME zhuozhengyun_usc
ENV USC_DB_PWD gzNYSIQq
ENV	USC_ROOT_PATH usc.csh4bhwz3tvf.rds.cn-north-1.amazonaws.com.cn
#本机 Mysql 参数
#ENV USC_DB_NAME root
#ENV USC_DB_PWD root
#ENV USC_ROOT_PATH 172.17.42.1

#MySQL 安装
#RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server
RUN apt-get update && apt-get install -y libmysqld-dev

#创建项目目录
RUN mkdir ${SERVER_NAME}

#删除默认 首页
RUN rm -rf /opt/nginx/html/index.html

#拷贝 Nginx 配置文件 以及二次开发的 openid 支持库
WORKDIR /var/www/
RUN mkdir logs
ADD script/nginx.conf $NGINX_CONF_PATH/
#ADD script/ruby-openid-2.7.0 /usr/local/rvm/gems/ruby-2.2-head/gems/

#添加启动文件
ADD script/start.sh /usr/local/
RUN chmod 777 /usr/local/start.sh

EXPOSE 80 
EXPOSE 3000

CMD /usr/local/start.sh

